﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    public class Dbhelper
    {
        private readonly static string conString = "uid=sa;pwd=123456;server=.;database=CMS";

        public static DataTable GetData(string sql)
        {
            DataTable data = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter(sql,conString);
            adapter.Fill(data);
            return data;
        }

        public static int AddOr(string sql)
        {
            SqlConnection connection = new SqlConnection(conString);
            SqlCommand command = new SqlCommand(sql,connection);
            connection.Open();
            int r = command.ExecuteNonQuery();
            connection.Close();
            return r;
        }
    }
}